import {
  submitSpaBookingInfo
} from '@/api/spa'
import {showText} from "../../utils/util";
Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    params:{
      type:Object,
      value:{}
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    imgUri: getApp().globalData.imgUri,
  },
  attached() {

  },
  /**
   * 组件的方法列表
   */
  methods: {
    submit(){

      let gender = '';
      if(this.data.params.gender == 1){
        gender = '男';
      }else{
        gender = '女';
      }
      let params = {
        mobile: this.data.params.mobile,
        name: this.data.params.name,
        bookingId: this.data.params.bookingId,
        gender:gender
      }
      submitSpaBookingInfo(params).then(res=>{
        if(res.code == 200){
          console.log(this.data.params,'1111')
          this.triggerEvent('success');
          wx.navigateTo({
            url: '/pages/bookSuccess/bookSuccess',
          });
        }else{
          showText(res.msg);
        }
      });

    },
    cancel(){
      this.triggerEvent('close')
    },
  }
})